package com.gxa.jjty.cjr.controller;


import com.gxa.jjty.cjr.service.SmsService;
import com.gxa.jjty.core.common.JsonResult;
import com.gxa.jjty.core.exception.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author NITRO
 */

@RestController
@RequestMapping("/sms")
public class SMSController {

    @Autowired
    private SmsService smsService;

    @PostMapping("/send")
    public Map sendSMSMap(@RequestParam("phone") String phone) throws BusinessException {
        String s = smsService.sendLoginSms(phone);
        JsonResult jsonResult=new JsonResult();
        jsonResult.setCode("1");
        jsonResult.setMsg("短信发送成功");
        jsonResult.setData(s);
        return jsonResult.getDataMap();

    }
}
